package com.gitee.huanminabc.dynamicdb.aop.dbswitch;

import org.aopalliance.aop.Advice;
import org.springframework.aop.Pointcut;
import org.springframework.aop.support.AbstractBeanFactoryPointcutAdvisor;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @author huanmin
 * @date 2024/11/22
 */
@Order(Ordered.HIGHEST_PRECEDENCE) // 尝试设置为最高优先级
public class DBSwitchAdvisor extends AbstractBeanFactoryPointcutAdvisor    {
    private final Pointcut dbPointCut;
    private final Advice dbAdvice;

    public DBSwitchAdvisor() {
        this.dbPointCut = new DBSwitchPointCut();
        this.dbAdvice = new DBSwitchAdvice();
    }

    @Override
    public Pointcut getPointcut() {
        return dbPointCut;
    }

    @Override
    public Advice getAdvice() {
        return dbAdvice;
    }

}
